package router

import (
	web "ShortLink/Core/Web"
	"ShortLink/Service"

	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {
	r := gin.Default()
	r.Use(web.GinLogger(), web.GinRecovery(true))
	r.GET("/:segment", Service.GoLink)
	r.POST("/link", Service.AddLink)
	r.DELETE("/link/:segment", Service.DelLink)
	r.PATCH("/link/:segment", Service.EditLink)
	return r
}
